from math import sqrt
a=int(input())
if a<1000 or a>9999:
    print("0")
else:
    a1=a//1000
    a2=a//100
    a3=a//10
    a4=a//100%10
    a5=a%10%100%1000
    a6=a%100
    a7=a%100//10
    a8=a%1000
    a9=a%1000//10
    B=[a, a1, a2, a3,a4,a5,a6,a7,a8,a9]
    for i in B :
        prime= True
        m=2
        while m<=sqrt(i):
            if i%m==0:
                prime= False
                break
            m+=1
    print(B)
